<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8" />
		<title>5.姓名案例_计算属性精简写法</title>
		<!-- 引入Vue -->
		<script type="text/javascript" src="../js/vue.js"></script>
	</head>
	<body>
		<!-- 准备好一个容器-->
		<div id="demo">
			姓：<input type="text" v-model="firstName"> <br>
			名：<input type="text" v-model="lastName"> <br><br>
			全名：<span>{{fullName}}</span><br>
		</div>

		<script type="text/javascript">
			let vm = new Vue({
				el:'#demo',
				data:{
					firstName:'zhang',
					lastName:'san',
				},
				methods: {
					changeSchool(){
						console.log('changeSchool')
					}
				},
				computed:{
					/* fullName:{
						get(){
							console.log('fullName对应的get函数执行了')
							return this.firstName.slice(0,1).toUpperCase() + this.firstName.slice(1) + '-' + this.lastName
						}
					} */
					fullName(){
						console.log('fullName对应的get函数执行了')
						return this.firstName.slice(0,1).toUpperCase() + this.firstName.slice(1) + '-' + this.lastName
					}
				}
			})
		</script>
	</body>
</html>